// 前端路由
import en from '../i18n/lang/en'
import Vue from 'vue'
import Router from 'vue-router'
// import CommerViews from '@/views/commerViews'
import Login from '@/views/login/index'
import Layout from '@/views/layout/layout'
import HomeMain from '@/views/index/mainIndex'

// 不是必须加载的组件使用懒加载
// const Icon = () => import('@/views/icon/index')
// const Erji = () => import('@/views/duoji/erji')
// const Erji2 = () => import('@/views/duoji/erji2')
// const Sanji = () => import('@/views/duoji/sanji')
// const Sanji2 = () => import('@/views/duoji/sanji2')
// const Siji = () => import('@/views/duoji/siji')
// const Wuji = () => import('@/views/duoji/wuji')
// const Transfer = () => import('@/views/transfer/transfer')
// const DataTable = () => import('@/views/table/dataTables')
// const FilterTable = () => import('@/views/table/filterTable')
// const DragTable = () => import('@/views/table/dragTabe')
// const Upload = () => import('@/views/upload/upload')
// const Markdown = () => import('@/views/editor/markdownView')
// const WangeditorView = () => import('@/views/editor/wangeditorView')
const NotFound = () => import('@/page404')
// const AddArticle = () => import('@/views/article/addArticle')
// const AddArticleEditor = () => import('@/views/article/addArticleEditor')
// const NavClassify = () => import('@/views/syssetting/navClassify')
// const pagePermissions = () => import('@/views/permissions/pagePermissions')
// const btnPermissions = () => import('@/views/permissions/btnPermissions')

const mavenPrivateService = () => import('@/views/maven/mavenPrivateService')
const zentaoCompany = () => import('@/views/zentao/zentaoCompany')
const zentaoDoc = () => import('@/views/zentao/zentaoDoc')
const zentaoEmail = () => import('@/views/zentao/zentaoEmail')
const zentaoProduct = () => import('@/views/zentao/zentaoProduct')
const zentaoProject = () => import('@/views/zentao/zentaoProject')
const zentaoQa = () => import('@/views/zentao/zentaoQa')

const codeAppiumUITest = () => import('@/views/codeManage/codeAppiumUITest')
const codeMartAndroid = () => import('@/views/codeManage/codeMartAndroid')
const codeMaximMonkey = () => import('@/views/codeManage/codeMaximMonkey')
const codeMayun = () => import('@/views/codeManage/codeMayun')
const codePhoneApiTest = () => import('@/views/codeManage/codePhoneApiTest')
const codeAppiumParallelTest = () => import('@/views/codeManage/codeAppiumParallelTest')

const jenkinsJobView = () => import('@/views/jenkins/jenkinsJobView')
const jenkinsMain = () => import('@/views/jenkins/jenkinsMain')

const sonarQube = () => import('@/views/sonar/sonarQube')

const openFalcon = () => import('@/views/openfalcon/openFalcon')

const gitbookwiki = () => import('@/views/wiki/gitbookwiki')
Vue.use(Router)
let routeNmae = en.routeNmae
let defaultRouter = [
  { path: '/',
    redirect: '/index',
    hidden: true,
    children: []
  },
  {
    path: '/login',
    component: Login,
    name: '',
    hidden: true,
    children: []
  },
  {
    path: '/index',
    iconCls: 'fa fa-dashboard', // 图标样式class
    name: routeNmae.home,
    component: Layout,
    alone: true,
    children: [
      {
        path: '/index',
        iconCls: 'fa fa-dashboard', // 图标样式class主页
        name: '主页',
        component: HomeMain,
        children: []
      }
    ]
  },
  {
    path: '/404',
    component: NotFound,
    name: '404',
    hidden: true,
    children: []
  }

]

let addRouter = [
  {
    path: '/',
    iconCls: 'el-icon-document',
    name: routeNmae.projectManagement, // 项目管理
    component: Layout,
    children: [
      {
        path: '/zentaoProduct',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.product,
        component: zentaoProduct, // 产品
        children: []
      },
      {
        path: '/zentaoProject',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.project,
        component: zentaoProject, // 项目
        children: []
      },
      {
        path: '/zentaoQa',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.qa,
        component: zentaoQa, // 测试
        children: []
      },
      {
        path: '/zentaoDoc',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.doc,
        component: zentaoDoc, // 文档
        children: []
      },
      {
        path: '/zentaoEmail',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.email,
        component: zentaoEmail, // 邮件
        children: []
      },
      {
        path: '/zentaoCompany',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.company,
        component: zentaoCompany, // 组织
        children: []
      }
    ]

  },
  {
    path: '/',
    iconCls: 'el-icon-share',
    name: routeNmae.codeManage, // 托管平台
    component: Layout,
    children: [
      {
        path: '/codeMayun',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.mayun, // 码云平台
        component: codeMayun,
        children: []
      },
      {
        path: '/codeMartAndroid',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.martAndroid, // Android本地商城
        component: codeMartAndroid,
        children: []
      },
      {
        path: '/codeAppiumUITest',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.appiumTest, // Appium自动化测试框架
        component: codeAppiumUITest,
        children: []
      },
      {
        path: '/codeAppiumParallelTest',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.appiumParallelTest, // Appium自动化测试框架
        component: codeAppiumParallelTest,
        children: []
      },
      
      {
        path: '/codeMaximMonkey',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.monkeyTest, // monkey测试框架
        component: codeMaximMonkey,
        children: []
      },
      {
        path: '/codePhoneApiTest',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.apiTest, // 接口自动化测试示例
        component: codePhoneApiTest,
        children: []
      }
    ]
  },
  {
    path: '/',
    iconCls: 'el-icon-setting',
    name: routeNmae.jenkins, // jenkins
    component: Layout,
    children: [
      {
        path: '/jenkinsMain',
        iconCls: 'el-icon-edit-outline', // 主页
        name: routeNmae.jenkinsMain,
        component: jenkinsMain,
        children: []
      },
      {
        path: '/jenkinsJobView',
        iconCls: 'el-icon-edit-outline', // 任务视图
        name: routeNmae.jobView,
        component: jenkinsJobView,
        children: []
      }
    ]
  },
  {
    path: '/',
    iconCls: 'el-icon-question',
    name: routeNmae.sonar, // 代码质量管理平台
    component: Layout,
    children: [
      {
        path: '/sonarQube',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.sonarQube,
        component: sonarQube,
        children: []
      }
    ]
  },
  {
    path: '/',
    iconCls: 'el-icon-view',
    name: routeNmae.falcon, // 系统监控
    component: Layout,
    children: [
      {
        path: '/openFalcon',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.openFalcon,
        component: openFalcon,
        children: []
      }
    ]
  },
  {
    path: '/',
    iconCls: 'el-icon-news',
    name: routeNmae.maven, // maven
    component: Layout,
    children: [
      {
        path: '/mavenPrivateService',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.mavenPrivateService,
        component: mavenPrivateService,
        children: []
      }
    ]
  },
  {
    path: '/',
    iconCls: 'el-icon-edit',
    name: routeNmae.wiki, // wiki知识沉淀
    component: Layout,
    children: [
      {
        path: '/gitbookwiki',
        iconCls: 'el-icon-edit-outline',
        name: routeNmae.gitbookwiki,
        component: gitbookwiki,
        children: []
      }
    ]
  }
  // {
  //   path: '/',
  //   iconCls: 'el-icon-tickets', // 图标样式class
  //   name: routeNmae.article,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/addArticle',
  //       iconCls: 'el-icon-edit-outline', // 图标样式class
  //       name: routeNmae.publishArticle,
  //       component: AddArticle,
  //       children: []
  //     },
  //     {
  //       path: '/addArticleEditor',
  //       iconCls: 'el-icon-edit-outline', // 图标样式class
  //       name: routeNmae.publishArticleEditor,
  //       component: AddArticleEditor,
  //       children: []
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'fa fa-paw', // 图标样式class
  //   name: routeNmae.icon,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/icon',
  //       iconCls: 'fa fa-life-ring', // 图标样式class
  //       name: routeNmae.builtInIcon,
  //       component: Icon,
  //       children: []
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'fa fa-exchange', // 图标样式class
  //   name: routeNmae.shuttleBox,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/transfer',
  //       iconCls: 'fa fa-sign-in', // 图标样式class
  //       name: routeNmae.demoShuttle,
  //       component: Transfer,
  //       children: []
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'fa fa-universal-access', // 图标样式class
  //   name: routeNmae.permissions,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/pagePermissions',
  //       iconCls: 'fa fa-expeditedssl', // 图标样式class
  //       name: routeNmae.pageControl,
  //       component: pagePermissions,
  //       children: []
  //     },
  //     {
  //       path: '/btnPermissions',
  //       iconCls: 'fa fa-toggle-on', // 图标样式class
  //       name: routeNmae.btnControl,
  //       component: btnPermissions,
  //       children: []
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'fa fa-newspaper-o', // 图标样式class
  //   name: routeNmae.table,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/dataTable',
  //       iconCls: 'fa fa-sliders', // 图标样式class
  //       name: routeNmae.multiDataTable,
  //       component: DataTable,
  //       children: []
  //     },
  //     {
  //       path: '/filterTable',
  //       iconCls: 'fa fa-sort-amount-asc', // 图标样式class
  //       name: routeNmae.filterTable,
  //       component: FilterTable,
  //       children: []
  //     },
  //     {
  //       path: '/dragTabe',
  //       iconCls: 'fa fa-hand-stop-o', // 图标样式class
  //       name: routeNmae.dragSort,
  //       component: DragTable,
  //       children: []
  //     }
  //   ]
  // },

  // {
  //   path: '/',
  //   iconCls: 'fa fa-server',
  //   name: routeNmae.multiDirectory,
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/erji1',
  //       iconCls: 'fa fa-server',
  //       name: routeNmae['menu2-1'],
  //       component: Erji,
  //       children: []
  //     },
  //     {
  //       path: '/erji2',
  //       iconCls: 'fa fa-server',
  //       name: routeNmae['menu2-2'],
  //       component: Erji2,
  //       children: []
  //     },
  //     {
  //       path: '/erji3',
  //       iconCls: 'fa fa-server',
  //       name: routeNmae['menu2-3'],
  //       component: CommerViews, // 无限极菜单的容器
  //       children: [
  //         {
  //           path: '/sanji1',
  //           iconCls: 'fa fa-server',
  //           name: routeNmae['menu3-1'],
  //           component: Sanji,
  //           children: []
  //         },
  //         {
  //           path: '/sanji2',
  //           iconCls: 'fa fa-server',
  //           name: routeNmae['menu3-2'],
  //           component: Sanji2,
  //           children: []
  //         },
  //         {
  //           path: '/sanji3',
  //           iconCls: 'fa fa-server',
  //           name: routeNmae['menu3-3'],
  //           component: CommerViews,
  //           children: [
  //             {
  //               path: '/siji',
  //               iconCls: 'fa fa-server',
  //               name: routeNmae['menu4-1'],
  //               component: Siji,
  //               children: []
  //             },
  //             {
  //               path: '/siji1',
  //               iconCls: 'fa fa-server',
  //               name: routeNmae['menu4-2'],
  //               component: CommerViews,
  //               children: [
  //                 {
  //                   path: '/wuji',
  //                   iconCls: 'fa fa-server',
  //                   name: routeNmae['menu5-1'],
  //                   component: Wuji,
  //                   children: []
  //                 }
  //               ]
  //             }
  //           ]
  //         }
  //       ]
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'fa fa-cloud-upload', // 图标样式class
  //   name: routeNmae.upload,
  //   component: Layout,
  //   meta: {role: ['superAdmin']},
  //   children: [
  //     {
  //       path: '/upload',
  //       iconCls: 'el-icon-upload2', // 图标样式class
  //       name: routeNmae.fileUpload,
  //       component: Upload,
  //       children: []
  //     }
  //   ]
  // },
  // {
  //   path: '/',
  //   iconCls: 'el-icon-edit', // 图标样式class
  //   name: routeNmae.editor,
  //   component: Layout,
  //   meta: {role: ['superAdmin', 'admin']},
  //   children: [
  //     {
  //       path: '/markdown',
  //       iconCls: 'fa fa-file-code-o', // 图标样式class
  //       name: routeNmae.markdown,
  //       component: Markdown,
  //       children: []
  //     },
  //     {
  //       path: '/wangeditor',
  //       iconCls: 'fa fa-file-code-o', // 图标样式class
  //       name: routeNmae.wangeditor,
  //       component: WangeditorView,
  //       children: []
  //     }
  //   ]
  // }
]
export default new Router({
  routes: defaultRouter
})
export {defaultRouter, addRouter}
